home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
El CD-ROM del Barça
/
El CD-ROM del Barça.zip
/
El CD-ROM del Barça
/
El CD-ROM del Barça.iso
/
sport1
/
final.dir
/
00573_Script_objScroll
< prev
next >
Wrap
Text File
|
1996-09-12
|
3KB
|
100 lines
property pScroll, pFond, pBouton, pConstrain
property pDelta, pPosBouton, pMinScroll, pMaxScroll, pPosScroll
on birth me, sprScroll, sprFond, sprBouton, sprConstrain, dimVisible
set pScroll = sprScroll
set pFond = sprFond
set pBouton = sprBouton
set pConstrain = sprConstrain
puppetSprite pScroll, TRUE
puppetSprite pBouton, TRUE
puppetSprite pConstrain, TRUE
set dimBouton2 = (the height of sprite pBouton) / 2
spriteBox pConstrain, the left of sprite pFond, the top of sprite pFond + dimBouton2,¼
the right of sprite pFond, the bottom of sprite pFond - dimBouton2
set dimScroll = the height of cast the castNum of sprite pScroll - dimVisible
set dimFond = the height of cast the castNum of sprite pFond -¼
the height of cast the castNum of sprite pBouton
set pDelta = float (dimScroll) / float (dimFond)
set pPosBouton = the locV of sprite pBouton
set pMaxScroll = the locV of sprite pScroll
set pMinScroll = pMaxScroll - dimScroll
set pPosScroll = the locV of sprite pScroll
return me
end birth
on dispose me
puppetSprite pScroll, FALSE
puppetSprite pBouton, FALSE
end dispose
on scroll me
dragMe me, pBouton
set deltaBouton = the locV of sprite pBouton - pPosBouton
set pPosBouton = the locV of sprite pBouton
set deltaScroll = pDelta * deltaBouton
delta me, deltaScroll
set pPosScroll = the locV of sprite pScroll
updateStage
end scroll
on dragMe me, channel
-- save the offsets where the mouseClicked on the sprite
-- so it wonÆt jump during first part of the drag:
set oVtl = the locV of sprite channel - the mouseV
--drag to a new position
repeat while the stillDown
set the locV of sprite channel to constrainV(pConstrain, the mouseV + oVtl)
updateStage
end repeat
end dragMe
on delta me, deltaScroll
set resScroll = the locV of sprite pScroll - deltaScroll
set resScroll = max (min(pMaxScroll, resScroll), pMinScroll)
set realScroll = the locV of sprite pScroll - resScroll
set the locV of sprite pScroll = resScroll
end delta
on updateBtn me
set deltaScroll = the locV of sprite pScroll - pPosScroll
if deltaScroll = 0 then exit
set deltaBouton = deltaScroll / pDelta
if the locV of sprite pScroll = pMinScroll then
set the locV of sprite pBouton to the bottom of sprite pConstrain
else if the locV of sprite pScroll = pMaxScroll then
set the locV of sprite pBouton to the top of sprite pConstrain
else
set the locV of sprite pBouton = pPosBouton - deltaBouton
end if
set pPosBouton = the locV of sprite pBouton
set pPosScroll = the locV of sprite pScroll
end updateBtn
on upArrow me
arrow me, -1
end upArrow
on downArrow me
arrow me, 1
end downArrow
on arrow me, sens
set c=0
set a=sens
repeat while the stillDown
set c=c+1
if c > 4 then
set a = a + sens
end if
delta (me, a)
updateStage
end repeat
updateBtn me
end arrow